Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

CI build was failing during page data collection phase with TypeError: Cannot read properties of undefined (reading 'map') in the fumadocs documentation site.

Changes

  • Added generateStaticParams() - Next.js requires this for catch-all routes [[...slug]] to determine which pages to statically generate
  • Added generateMetadata() - Required for metadata generation during build; includes error handling for missing pages
  • Switched to static generation - Changed dynamicParams to false and removed dynamic = 'force-dynamic'
  • Updated Next.js to 15.3.0 - Matches [email protected] peer dependency requirement (was 15.1.6)
  • Added root meta.json - Defines navigation structure for docs at content/docs/meta.json
export function generateStaticParams() {
  return source.generateParams();
}

export async function generateMetadata(props: {
  params: Promise<{ slug?: string[] }>;
}): Promise<Metadata> {
  const params = await props.params;
  const page = source.getPage(params.slug);
  
  if (!page) return {};
  
  return {
    title: page.data.title || 'Documentation',
    description: page.data.description || undefined,
  };
}

Note

Build still fails at same point. Root cause appears to be fumadocs-mdx 14.x / fumadocs-core 15.x compatibility issue or missing async mode configuration. These changes are necessary prerequisites but may not be sufficient.

Original prompt

引用: https://github.com/objectstack-ai/objectos/actions/runs/21140744267/job/60795455667#step:6:1


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Add generateStaticParams function to export static params for all doc pages
- Add generateMetadata function to properly generate page metadata
- Change dynamicParams from true to false and remove 'force-dynamic'
- Update Next.js from 15.1.6 to 15.3.0 to match fumadocs-mdx peer dependencies
- Add root meta.json for docs navigation structure
- Add description rendering in page component

These changes address the build error "Failed to collect configuration" by ensuring
Next.js has the required functions for static generation.

Co-authored-by: huangyiirene <[email protected]>
Copilot AI changed the title [WIP] Update action run log for better clarity Add generateStaticParams and generateMetadata to fix Next.js build failure Jan 19, 2026
Copilot AI requested a review from huangyiirene January 19, 2026 15:29
@hotlong hotlong marked this pull request as ready for review January 20, 2026 03:06
Copilot AI review requested due to automatic review settings January 20, 2026 03:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Next.js build failures by implementing proper static generation for the fumadocs documentation site. The changes convert the dynamic catch-all route to static generation by adding required functions and updating dependencies.

Changes:

  • Added generateStaticParams() and generateMetadata() functions to enable static page generation
  • Updated Next.js from version 15.1.6 to 15.3.0 to match fumadocs-mdx peer dependency requirements
  • Added meta.json configuration file to define documentation navigation structure
  • Enhanced page component to display document descriptions

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
apps/site/app/docs/[[...slug]]/page.tsx Added static generation functions (generateStaticParams, generateMetadata), switched from dynamic to static rendering, and added description display
apps/site/package.json Updated Next.js dependency from ^15.1.6 to ^15.3.0
pnpm-lock.yaml Updated lockfile to reflect Next.js version change (resolves to 15.5.9)
apps/site/content/docs/meta.json Added navigation structure configuration for documentation pages
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +26 to +28
} catch (error) {
console.error('Error in generateMetadata:', error);
return {};
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling in generateMetadata silently swallows all errors by logging to console and returning an empty metadata object. This could hide important issues during the build process. Consider removing the try-catch wrapper since Next.js will handle errors appropriately during static generation, or at minimum, re-throw the error after logging it so the build fails with a clear error message.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +19
if (!page) {
return {};
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is inconsistent error handling between generateMetadata and the Page component. In generateMetadata (line 18-19), when a page is not found, an empty metadata object is returned. However, in the Page component (line 37), the same condition triggers a notFound() call which returns a 404. This inconsistency means pages will be generated with empty metadata even though they don't exist. Consider calling notFound() in generateMetadata when page is null to maintain consistency.

Copilot uses AI. Check for mistakes.
"fumadocs-ui": "^15.0.0",
"lucide-react": "^0.344.0",
"next": "^15.1.6",
"next": "^15.3.0",
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Next.js version specifier change from ^15.1.6 to ^15.3.0 allows the package manager to install version 15.5.9 (as shown in pnpm-lock.yaml line 86). While this may work, there's a risk of compatibility issues with the [email protected] package. The PR description mentions fumadocs-mdx requires Next.js 15.3.0 as a peer dependency, but the actual resolved version is 15.5.9. Consider pinning to a more specific version range (e.g., "^15.3.0 <15.4.0") or testing with the exact peer dependency version to ensure compatibility.

Suggested change
"next": "^15.3.0",
"next": "15.3.0",

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants